import 'package:flutter/material.dart';
import 'package:reabampos/src/app.dart';
import 'package:reabampos/src/reabam/operation/rb_config.dart';
import 'package:reabampos/src/reabam/operation/rb_enum.dart';
import 'package:tencent_bugly_plugin/bugly_config.dart';
import 'package:tencent_bugly_plugin/bugly_plugin.dart';
import 'package:xsdk_flutter/xsdk/framework/x_app.dart';
import 'package:xsdk_flutter/xsdk/xsdk_flutter_package.dart';

void main() {

  String titleName='睿本云HD';

  if(RBConfigs.versionType==VersionType.baodaoVersion){
    //包道正式版
    titleName='包道收银';
  }else if(RBConfigs.versionType==VersionType.bluegreenVersion){
    //蓝绿版
    titleName='睿本云HD蓝绿';
  }else if(RBConfigs.versionType==VersionType.testVersion){
    //测试版
    titleName='睿本云HD测试';
  }else if(RBConfigs.versionType==VersionType.developerVersion){
    //开发板
    titleName='睿本云HD开发';
  }else if(RBConfigs.versionType==VersionType.testSelfServiceVersion){
    //测试版
    titleName='睿本云自助收银测试';
  }else if(RBConfigs.versionType==VersionType.officialSelfServiceVersion){
    //正式
    titleName='睿本云自助收银';
  }


  XSDKApp.runXSDKApp(
      MyApp(titleName: titleName),
      initFunction: (){
        if(XFlutterUtils.isAndroidOriOSSystem()){
          BuglyPlugin.initBugly(
              BuglyConfig(
                  androidAppId: "00e2d9c059",
                  iosAppId: "ba0b0c6400",
                  channel: "xsdk",
                  debugMode: false),
              flutterError: (FlutterErrorDetails flutterError) {

                XLogUtils.printLog('BuglyPlugin flutterError捕获异常: ${flutterError.exception}');
                XLogUtils.printLog('BuglyPlugin flutterError捕获异常: ${flutterError.stack}');

                BuglyPlugin.reportException('BuglyPlugin flutterError', 'exception=${flutterError.exception},stack=${flutterError.stack}');
              }
          );
        }
      }
  );

}
